import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App'

// 获取root元素并确保其存在
const rootElement = document.getElementById('root');
if (!rootElement) {
  throw new Error('Failed to find the root element');
}

createRoot(rootElement).render(
  <StrictMode>
    <App />
  </StrictMode>,
);

window.addEventListener('storage', (event) => {
  if (event.key === 'access_token') {
    window.location.reload();
  }
});
